package com.ctshk.rpc.ship.mapper;

import com.ctshk.rpc.ship.entity.ShipProductSaleRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 产品库存售卖记录 Mapper 接口
 * </p>
 *
 * @author 刘蕾
 * @since 2021-03-18
 */
public interface ShipProductSaleRecordMapper extends BaseMapper<ShipProductSaleRecord> {

    @Select("<script>"+"SELECT * FROM t_ship_product_sale_record WHERE date(sales_date) = curdate() and product_id=#{product_id} and channel=#{channel} <if test='checkType != null'> and check_type=#{checkType} </if> and line=#{line}" + "</script>")
    List<ShipProductSaleRecord> getCurrentSaleRecord(@Param("product_id") Long productId, @Param("channel")Integer channel, @Param("checkType") Integer checkType, @Param("line") Integer line);

}
